<template>
  <div class="nav-bar">
    <div class="left" v-if="isBack" @click="$router.back()">
      <slot name="left">
        <i class="iconfont icon-fanhui" />
      </slot>
    </div>
    <div class="left" v-else>
      <slot name="left"></slot>
    </div>
    <div class="center">
      <slot name="center"></slot>
    </div>
    <div :style="{ width: rightWidth }">
      <slot name="right"></slot>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    rightWidth: {
      type: String,
      default: '60px'
    },
    isBack: Boolean
  }
}
</script>

<style lang="less" scoped>
.nav-bar {
  display: flex;
  width: 100%;
  text-align: center;
  height: 44px;
  align-items: center;
  z-index: 9;
  .left {
    width: 60px;
  }
  .center {
    flex: 1;
  }
}
</style>
